package com.example;

/**
 * @author lzj
 * @since 获取一个类的 class type
 */
public class TestClassType {
    /**
     * @since 一个类的class type
     */
    public static void main(String s[]) {
        String str = new String();
        Class clazz1 = str.getClass();
        Class clazz2 = String.class;

        Class clazz3 = null;
        try {
            clazz3 = Class.forName("java.lang.String");
            String str3 = (String) clazz3.newInstance();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }

        System.out.println(clazz1 == clazz2);
        System.out.println(clazz3 == clazz2);

        System.out.println(int.class);
        System.out.println(Integer.class);
        System.out.println(void.class);

        System.out.println(int.class.getName());
        System.out.println(Integer.class.getName());
        System.out.println(Integer.class.getSimpleName());

    }


}



